<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    public function wxservice()
    {
        $app = app('wechat.official_account');
        $app->server->push(function($message)
        {
            return "欢迎关注 overtrue！";
        });

        return $app->server->serve();
    }

    //微信授权
    public function wxauth(Request $request)
    {
        //将历史信息加载到新的请求头里面

    }

    public static function adminview($path,$data=[]){
        return view("chinabank/admin/".$path,$data);
    }


    public static function send($code=200,$msg="SUCCESS",$data = [])
    {
        if(is_array($code)){
            $data = $code;
            $code = 200;
        }

        $base = ['code'=>$code,"msg"=>$msg];
        $data = array_merge($base,$data);
        return response($data);
    }
}
